const express = require('express');
const router = express.Router();

const data = [];
for(let i = 1; i < 51; i++)
    data.push({
        id: `string${i}`,
        dealerCode: `string${i}`,
        dealerName: `string${i}`,
        partId: `string${i}`,
        partCode: `string${i}`,
        partName: `string${i}`,
        rowVersion: 'string'
    });


router.get('/forCurrentUser', (req, res) => {
    res.json(
        {
            message: '',
            payload: {
                content: data,
                totalElements: 50,
            }
        }
    );
});
router.get('/export/forCurrentUser', (req, res) => {
    setTimeout(() => {
        res.json({
            message: '导出成功',
            payload: 'Mock导出'
        });
    }, 1000);
});

router.post('/batchDelete', (req, res) => {
    res.json({
        message: '批量删除'
    });
});

router.post('/importQuery', (req, res) => {
    res.json({
        message: '导入成功',
        payload: {
            content: [{
                id: 'string1',
                dealerCode: 'string',
                dealerName: 'string',
                partId: 'string1',
                partCode: 'string',
                partName: 'string',
            }, {
                id: 'string2',
                dealerCode: 'string',
                dealerName: 'string',
                partId: 'string2',
                partCode: 'string',
                partName: 'string',
            }]
        }
    });
});
router.post('/importSubmit', (req, res) => {
    res.json({
        message: '导入提交成功',
    });
});
router.post('/importDelete', (req, res) => {
    res.json({
        message: '导入删除成功'
    });
});

module.exports = router;
